package com.partterns.factory;

/**
 * 扩展了AbstractFactory的工厂类
 */
public class ShapeFactoryAbs extends AbstractFactory{
    @Override
    Shape getShape(String shapeType) {
        if(shapeType == null){
            return null;
        }
        //equalsIgnoreCase()方法比较字符串到另一个字符串，忽略大小写因素。
        if(shapeType.equalsIgnoreCase("CIRCLE")){
            return new Circle();
        } else if(shapeType.equalsIgnoreCase("RECTANGLE")){
            return new Rectangle();
        } else if(shapeType.equalsIgnoreCase("SQUARE")){
            return new Square();
        }
        return null;
    }

    @Override
    Color getColor(String color) {
        return null;
    }
}
